package me.leiusual.sharing.api.model

import me.leiusual.sharing.pref.Token

/**
 * Create by leiusual on 2018/7/18
 */
class AccessToken {

  data class Response(
      val access_token: String,
      val token_type: String,
      val refresh_token: String,
      val expires_in: Long,
      val scope: String
  ) {

    fun replace(token: Token) {
      token.accessToken = access_token
      token.tokenType = token_type
      token.refreshToken = refresh_token
      token.expiresIn = System.currentTimeMillis() + expires_in * 1000
      token.scope = scope
    }
  }
}